const mongoose = require('mongoose');

mongoose.connect('mongodb://127.0.0.1:27017/yang', { useNewUrlParser: ture }, (err) => {
    if (err) {
        console.log(err);
        return;
    }
    console.log("mongo连接成功");
})


//创建获取 Schema
var UserSchema = mongoose.Schema({
    name: String,
    age: {
        type: Number, //指定数据类型
        default: 0 //可以指定默认数据
    }
});

module.exports = mongoose.model('User', UserSchema, 'users');